package com.vichat.core.dao;

import org.hibernate.type.BasicType;
import org.hibernate.type.Type;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.List;
import java.util.Map;

public interface BaseDaoI<T> {

	public Serializable save(T o);

	public void delete(T o);
	
	public void deleteClear(T o);

	public void deleted(T o);

	public void update(T o);


	public void updateOnly(T o);

	public void saveOrUpdate(T o);

	public T get(Class<T> c, Serializable id);

	public T get(String hql);

	public T get(String hql, Map<String, Object> params);

	public List<T> find(String hql);

	public List<T> find(String hql, Map<String, Object> params);

	public List<T> find(String hql, Map<String, Object> params, int page, int rows);

	public List<T> find(String hql, int page, int rows);

	public Long count(String hql);

	public Long count(String hql, Map<String, Object> params);

	public int executeHql(String hql);

	public int executeHql(String hql, Map<String, Object> params);

	public List<Object[]> findBySql(String sql);
	
	public List<Integer> findForSql(String sql);
	
	public List<String> findSqlToString(String sql);
	
	public List findForSqlPage(String sql, Class entityClass, int page, int rows);
	
	public List<Integer> findForSqlPage(String sql, int page, int rows);
	
    public List<Object[]> findBySql(String sql, String[] colName, Type[] colType);

	public List<Object[]> findBySql(String sql, int page, int rows);

	public List<Object[]> findBySql(String sql, Map<String, Object> params);

	public List<Object[]> findBySql(String sql, Map<String, Object> params, int page, int rows);


	public int executeSql(String sql);

	public int executeSql(String sql, Map<String, Object> params);

	public BigInteger countBySql(String sql);

	public BigInteger countBySql(String sql, Map<String, Object> params);

	public List findEntityBySql(String sql, Map<String, Object> params, Class entityClass);
	public List findEntityBySql(String sql, Map<String, Object> params, Class entityClass, int page, int rows);
    public List findVoBySql(String sql, Map<String, Object> params, Map<String,BasicType> scalas, Class entityClass);

    public List findVoBySql(String sql, Map<String, Object> params, Class entityClass, int page, int rows);

	public Object executeQueryBasic(String sql, String colName, Type colType);

}
